/*Hdip Project 2013-14, Student Name:- Chris Pembroke,  Student Number:- x00115839*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Exercise1Project.Models
{
    public class CustomerDetailsDatabaseLogic : ICustomerDetailRepository
    {
        private BicycleRepairEntities2 _db = new BicycleRepairEntities2();

        public User GetCustomerDetailsByCustomerId(string id)  // return a customers details from the user table
        {
            return  _db.Users.FirstOrDefault(c => c.Id == id);
        }

        public User UpdateCustomerDetails(User userToUpdate)   // updates a customers details in the user table
        {
            _db.Entry(userToUpdate).State = System.Data.Entity.EntityState.Modified;
            _db.SaveChanges();
            return userToUpdate;
        }


    }
}